home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / mus / edit / med_3_22.lha / programmers / modplayer / modplayer.h < prev    next >
C/C++ Source or Header  |  1991-08-25  |  6KB  |  159 lines

  1. /* C definitions for using the 'modplayer.a' and 'mod8player.a'
  2.    play-routines of OctaMED V2.00 and MED V3.20 */
  3.  
  4. #ifndef EXEC_TYPES_H
  5. #include <exec/types.h>
  6. #endif
  7.  
  8. /* If "libproto.h" has been loaded, we don't define the "modplayer.a"
  9.    functions. */
  10. #ifndef MEDPLAYER_LIBPROTO
  11. #ifdef LATTICE
  12. /* In 'modplayer.a' */
  13. LONG __asm InitPlayer(void);
  14. void __asm RemPlayer(void);
  15. void __asm PlayModule(register __a0 struct MMD0 *);
  16. void __asm ContModule(register __a0 struct MMD0 *);
  17. void __asm StopPlayer(void);
  18. void __asm SetTempo(register __d0 UWORD);
  19. /* In 'loadmod.a' */
  20. struct MMD0 * __asm LoadModule(register __a0 char *);
  21. /*void __asm RelocModule(register __a0 struct MMD0 *);*/
  22. void __asm UnLoadModule(register __a0 struct MMD0 *);
  23. /* These are the definitions for the 8-channel OctaMED routines,
  24.    in 'mod8player.a' (not provided with MED). */
  25. LONG __asm InitPlayer8(void);
  26. void __asm RemPlayer8(void);
  27. void __asm PlayModule8(register __a0 struct MMD0 *);
  28. void __asm ContModule8(register __a0 struct MMD0 *);
  29. void __asm StopPlayer8(void);
  30. #endif
  31.  
  32. /* If you're playing multi-modules, set the 'modnum' variable to the
  33.    number of the song you want to play before calling PlayModule(). */
  34.  
  35. #ifdef LATTICE_50
  36. extern UWORD far modnum;
  37.  
  38. /* 'modnum8' is the equivalent in 'mod8player' */
  39.  
  40. extern UWORD far modnum8;
  41. #else
  42. extern UWORD modnum,modnum8; /* for less intelligent compilers */
  43. #endif
  44.  
  45. #endif MEDPLAYER_LIBPROTO
  46.  
  47. /* This is the main module structure */
  48. struct MMD0 {
  49.     ULONG    id;            /* "MMD0" */
  50.     ULONG    modlen;            /* module length (in bytes) */
  51.     struct    MMD0song *song;        /* pointer to MMD0song */
  52.     ULONG    songlen;        /* length of song (not currently used) */
  53.     struct    MMD0block **blockarr;    /* pointer to pointers of blocks */
  54.     ULONG    blockarrlen;        /* length... */
  55.     struct    Soitin **smplarr;    /* pointer to pointers of samples */
  56.     ULONG    smplarrlen;        /* len.. */
  57.     struct    MMD0exp *expdata;    /* pointer to expansion data */
  58.     ULONG    expsize;        /* lenght again.. */
  59. /* The following values are used by the play routine */
  60.     UWORD    pstate;            /* the state of the player */
  61.     UWORD    pblock;            /* current block */
  62.     UWORD    pline;            /* current line */
  63.     UWORD    pseqnum;        /* current # of playseqlist */
  64.     WORD    actplayline;        /* OBSOLETE!! DON'T TOUCH! */
  65.     UBYTE    counter;        /* delay between notes */
  66.     UBYTE    extra_songs;        /* number of additional songs, see
  67.                        expdata->nextmod */
  68. };
  69.  
  70. /* These are the structures for future expansions */
  71.  
  72. struct InstrExt {    /* This struct only for data required for playing */
  73. /* NOTE: THIS STRUCTURE MAY GROW IN THE FUTURE, TO GET THE CORRECT SIZE,
  74.    EXAMINE mmd0->expdata->s_ext_entrsz */
  75.     UBYTE hold;
  76.     UBYTE decay;
  77.     UBYTE suppress_midi_off;    /* 1 = suppress, 0 = don't */
  78.     UBYTE pad0;            /* This may be used in the future... */
  79. };
  80.  
  81. struct MMDInstrInfo {
  82.     UBYTE    name[40];
  83.     UBYTE    pad0;    /* two pads? */
  84.     UBYTE    pad1;
  85. };
  86.  
  87. struct MMD0exp {
  88.     struct MMD0 *nextmod;        /* for multi-modules */
  89.     struct InstrExt *exp_smp;    /* pointer to an array of InstrExts */
  90.     UWORD  s_ext_entries;        /* # of InstrExts in the array */
  91.     UWORD  s_ext_entrsz;        /* size of an InstrExt structure */
  92.     UBYTE  *annotxt;        /* 0-terminated message string */
  93.     ULONG  annolen;            /* length (including the 0-byte) */
  94. /* MED V3.20 data below... */
  95.     struct MMDInstrInfo *iinfo;    /* "secondary" InstrExt for info,
  96.                     that has no affection on output */
  97.     UWORD  i_ext_entries;        /* # of MMDInstrInfos */
  98.     UWORD  i_ext_entrsz;        /* size of one */
  99.     ULONG  jumpmask;        /* jumpmask for Topi (aaaarrrgh!!!) */
  100.     UWORD  *rgbtable;        /* pointer to 8 UWORD values */
  101.     UBYTE  channelsplit[4];    /* for OctaMED only (non-zero = NOT splitted) */
  102. /* leave these to zero! */
  103.     struct NotationInfo *n_info;    /* OctaMED notation editor info data */
  104. /* This are still left, they must be 0 at the moment. */
  105.     ULONG  reserved2[10]; /* better have enough of these... */
  106. };
  107.  
  108. /* Info for each instrument (mmd0->song.sample[xx]) */
  109.  
  110. struct MMD0sample {
  111.     UWORD rep,replen;    /* repeat/repeat length */
  112.     UBYTE midich;        /* midi channel for curr. instrument */
  113.     UBYTE midipreset;    /* midi preset (1 - 128), 0 = no preset */
  114.     UBYTE svol;        /* default volume */
  115.     BYTE strans;        /* sample transpose */
  116. };
  117.  
  118. /* The song structure (mmd0->song) */
  119.  
  120. struct MMD0song {
  121.     struct MMD0sample sample[63];    /* info for each instrument */
  122.     UWORD    numblocks;        /* number of blocks in this song */
  123.     UWORD    songlen;        /* number of playseq entries */
  124.     UBYTE    playseq[256];        /* the playseq list */
  125.     UWORD    deftempo;        /* default tempo */
  126.     BYTE    playtransp;        /* play transpose */
  127.     UBYTE    flags;            /* flags (see below) */
  128.     UBYTE    reserved;        /* for future expansion */
  129.     UBYTE    tempo2;            /* 2ndary tempo (delay betw. notes) */
  130.     UBYTE    trkvol[16];        /* track volume */
  131.     UBYTE    mastervol;        /* master volume */
  132.     UBYTE    numsamples;        /* number of instruments */
  133. }; /* length = 788 bytes */
  134.  
  135.  /* FLAGS of the above structure */
  136. #define    FLAG_FILTERON    0x1    /* hardware low-pass filter */
  137. #define    FLAG_JUMPINGON    0x2    /* jumping.. */
  138. #define    FLAG_JUMP8TH    0x4    /* jump 8th.. */
  139. #define    FLAG_INSTRSATT    0x8    /* instruments are attached (sng+samples)
  140.                    used only in saved MED-songs */
  141. #define    FLAG_VOLHEX    0x10    /* volumes are represented as hex */
  142. #define FLAG_STSLIDE    0x20    /* no effects on 1st timing pulse (STS) */
  143. #define FLAG_8CHANNEL    0x40    /* OctaMED 8 channel song, examine this bit
  144.                    to find out which routine to use */
  145. /* flags in struct NotationInfo */
  146. #define NFLG_FLAT 1
  147. #define NFLG_3_4  2
  148.  
  149. struct NotationInfo {
  150.     UBYTE n_of_sharps;    /* number of #'s (or b's) */
  151.     UBYTE flags;        /* flags (see above) */
  152.     WORD  trksel[5];    /* selected track for each preset (-1 = none) */
  153.     UBYTE trkshow[16];    /* which tracks to show (bit 0 = for preset 0,
  154.                 bit 1 for preset 1 and so on..) */
  155.     UBYTE trkghost[16];    /* ghosted tracks (like trkshow[]) */
  156.     BYTE  notetr[63];       /* -24 - +24 (if bit #6 is negated, hidden) */
  157.     UBYTE pad;    /* perhaps info about future extensions */
  158. };
  159.